package com.lanou3g.myapplication.adapter;

import android.content.Context;
import android.support.v4.view.PagerAdapter;
import android.util.Log;
import android.view.View;
import android.view.ViewGroup;

import com.lanou3g.myapplication.bean.BeanData;

import java.util.List;

/**
 * Created by dllo on 16/1/18.
 */
public class DetalisImageAdapter extends PagerAdapter {
    private List<View> data;


    public DetalisImageAdapter(List<View> data) {
        this.data = data;
    }

    @Override
    public int getCount() {
        return data.size();
    }

    @Override
    public boolean isViewFromObject(View view, Object object) {
        return view==object;
    }


    @Override
    public void destroyItem(ViewGroup container, int position, Object object) {
//        super.destroyItem(container, position, object);
    container.removeView(data.get(position));
    }

    @Override
    public View instantiateItem(ViewGroup container, int position) {
//        Log.d("DetalisImageAdapter", "position    "+position+"  data.size():" + data.size());
        container.addView(data.get(position));
        return data.get(position);
    }
}
